home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Image Engineer Script */ /* Batch convert and render script */ /* by Simon Edwards */ /* */ /* Demonstrates how to use ARexx to batch */ /* load, render, convert and save images. */ Options results /* We want results */ signal on error /* Setup a place for errors to go */ address 'IMAGEENGINEER' IE_To_Front 'TYPE 24bit' /* Set load type */ /* Get some file names from the user */ 'GET_FILES "Select files to convert" "Ok" "ram:"' MyFileList=RESULT /* Ask the user how they want to render */ /* the images */ 'GET_RENDER COLOUR "Set render options" 0 593920 8 1 256 1 2' RenderOptions=RESULT /* Get the desitination directory from the user */ 'GET_DIR "Select Destination Directory" "Ok" "ram:"' DestDir=result /* Fix DestDir so that we can just concatenate the */ /* file name to it to build complete paths */ endpart=right(DestDir,1) if endpart~=":" & endpart~="/" then DestDir=DestDir||"/" /* Get the destination file format */ 'GET_FILE_TYPE "Select Destination File Format"' FileType=RESULT /* Let the user enter a file extension to use */ parse var FileType fileext . 'GET_STRING "Enter file extension" "Ok|Cancel" ".'||fileext||'"' FileExt=RESULT /* Ask the user if they would like this done */ /* in the Background */ 'REQUEST "Shall I do this in the Foreground or Background?" "Fore|Back"' Fore=RESULT if Fore~=1 then do /* If we should work in the background then */ 'WB_TO_FRONT' /* we need to bring the WB to the front and */ 'SET_PRI -1' /* drop our task priority to something friendly */ end /* Keep going till we run out of files */ do while MyFileList~="" /* Get the next file name */ parse var MyFileList x ';' MyFileList /* Extract the file name from the complete path */ parse var x ':' temp if temp="" then temp=x do forever parse var temp FileName '/' temp if temp ="" then break end 'OPEN "'||x||'"' /* Open the image */ Project=RESULT /* Set up this images render options */ 'SET_RENDER' Project RenderOptions if Fore=1 then do /* See if we should be quiet or not when rendering */ 'RENDER' Project end else do /* We're in the background so we should render */ /* quietly */ 'RENDER' Project 'QUIET' end /* Save the rendered image */ 'SAVE' Project '"'||destdir||filename||fileext||'" "'||filetype||'"' 'CLOSE' Project end 'IE_TO_FRONT' 'SET_PRI 0' 'REQUEST "All done."' exit /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do /* Did the user just cancel us? */ IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' exit end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' exit end